//----------------------------------------------------------------------------
/** @file Move.h */
//----------------------------------------------------------------------------

#ifndef MOVE_H
#define MOVE_H

#include <iosfwd>
#include "../smartgame/SgBlackWhite.h"
#include "../smartgame/SgPoint.h"

//----------------------------------------------------------------------------

/** Move and color of player who plays it. */
class Move {
public:
	Move(SgBlackWhite color, SgPoint point = SG_NULLMOVE);
	Move(const Move& m);

	Move();

	~Move();

	bool operator==(const Move& move) const;

	bool operator!=(const Move& move) const;

	SgPoint Point() const;

	SgBlackWhite Color() const;

	void SetPoint(SgPoint move);

	void copy(Move m) {
		m_color = m.m_color;
		m_point = m.m_point;
	}

private:
	SgBlackWhite m_color;

	SgPoint m_point;
};

inline Move::Move() :
	m_color(SG_BLACK), m_point(SG_NULLMOVE) {
}

inline Move::Move(SgBlackWhite color, SgPoint point) :
	m_color(color), m_point(point) {
	SG_ASSERT_BW(color);
}

inline Move::Move(const Move& m) :
	m_color(m.m_color), m_point(m.m_point) {

}

inline Move::~Move() {
}

inline bool Move::operator==(const Move& move) const {
	return (m_color == move.m_color && m_point == move.m_point);
}

inline bool Move::operator!=(const Move& move) const {
	return !operator==(move);
}

inline SgPoint Move::Point() const {
	return m_point;
}

inline void Move::SetPoint(SgPoint point) {
	m_point = point;
}

inline SgBlackWhite Move::Color() const {
	return m_color;
}

//----------------------------------------------------------------------------

std::ostream& operator<<(std::ostream& out, Move mv);

//----------------------------------------------------------------------------

#endif // GO_PLAYERMOVE_H
